{extend name="pc/admin/layout"/}
{block name="main"}
   <div class="g-1400 g-container" id="pjax-container">
        
<div class="bg-bai b rx3" id="vue-page">
    <div class="t-v t-t">
        <div class="c-sidebar c-sidebar-h pb5 br">
            <div class="c-sidebar-title t-v hui bb">编辑公告</div>
            <ul class="c-nav click-nav">
				<li class="active"><a class="t-v" href="{:url('pc/admin',['act'=>'data','s'=>'gg_list'])}" data-pjax="">
                    <font class="v-1">返回列表</font>
                </a></li>
            </ul>
        </div>
<div class="c-content bl">
    <div class="g-title t-v pl4 bb">
        <div class="col-8 h t-v bold">公告信息</div>
        <div class="col-4 t-v t-r"></div>
    </div>
	<div class="p5 o-h">
	<form id="form" style="padding-left: 25px;padding-right: 25px;">
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">公告类型</dt>
            <dd><select class="form w h8 bb" name="type" default="{$data.type}">
                {if condition="$data.type == 0"}
				<option value="0" >0_普通公告</option>
				{elseif condition="$data.type == 1"}
				<option value="1" {if condition="$data.type eq 1" }selected {/if}>1_平台广告</option>
				{else /}
				<option value="2" {if condition="$data.type eq 2" }selected {/if}>2_推荐链接</option>
				{/if}
            </select></dd>
        </div>
		<div id="frame_set" style="display:inherit">
		<div class="pt3 pb3">
				<div><font class="f4 bold lan">公告内容</font></div>
				<div class="mt2"><textarea type="text" class="form b"  name="con" rows="3" autocomplete="off">{$data.con}</textarea></div>
		</div>
		</div>
		<div id="frame_set2" style="display:inherit">
		<div class="pt1 pb3 in-text">
			<dt class="bold bb pr2 lan">跳转链接</dt>
			<dd><input type="url" class="form w h8 bb" name="url" value="{$data.url}"></dd>
		</div>
		</div>
		<div id="frame_set3" style="display:inherit">
		<div class="pt1 pb3 in-text">
			<dt class="bold bb pr2 lan">字体颜色</dt>
			<dd><input type="color" name="color" value="{$data.color}" class="form w h8 bb"></dd>
		</div>
		</div>
		<div id="frame_set4" style="display:inherit">
		<div class="pt1 pb3 in-text">
			<dt class="bold bb pr2 lan">到期时间</dt>
			<dd><input type="date" name="enddate" value="{$data.enddate}" class="form w h8 bb"></dd>
		</div>
		</div>
		</form>
		</div>
		</div>
</div>
<div class="c-pagination o-h t-v">
        <div class="c-sidebar"></div>
        <div class="c-content h11 o-h g-btn t-v bt bl">
            <div class="col-12 h t-v f3 hui pl5 pr5 t-c">
			<button class="btn btn-qing btn-md w22 rx1" @click="save()">保 存 设 置</button></div>
        </div>
    </div>
</div>

    </div>
   {/block}
   {block name='foot'}
		<script>
        new Vue({
            el: '#vue-page',
            methods: {
                save: function () {
                    app.ajax("{:url('AdminAjax/ggList',['action'=>'edit'])}?id=" + "{$data.id}", $("#form").serialize(), function (data) {
                        if (data.code === 0) {
                            x.msg(data.message)
                        } else {
                            x.msg(data.message)
                        }
                    })
                }
            }
        });
		var select = $("select[name='type']").val();
        if (select == 0) {
            $("#frame_set").css("display", "inherit");
            $("#frame_set2").css("display", "none");
            $("#frame_set3").css("display", "none");
            $("#frame_set4").css("display", "none")
        } else if (select == 1) {
            $("#frame_set").css("display", "inherit");
            $("#frame_set2").css("display", "inherit");
            $("#frame_set3").css("display", "inherit");
            $("#frame_set4").css("display", "inherit")
        } else {
            $("#frame_set").css("display", "inherit");
            $("#frame_set2").css("display", "inherit");
            $("#frame_set3").css("display", "none");
            $("#frame_set4").css("display", "none");
        }
    </script>
    {/block}